package main.java.tmi.main.service.impl;

import java.sql.SQLException;
import java.util.List;

import javax.annotation.Resource;

import main.java.tmi.common.service.UserVO;
import main.java.tmi.main.service.MainService;
import main.java.tmi.main.service.MainVO;

import org.springframework.stereotype.Service;
import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder;

/**
 * main ���� ���� Ŭ����
 *
 * @author min��
 * @since 2012. 04. 15
 */
@Service
public class MainServiceImpl implements	MainService {

	

	@Resource(name = "mainDAO")
	protected MainDAO mainDAO;
	
	public List<MainVO> listMenu() throws SQLException {
		UserVO userInfo = (UserVO) RequestContextHolder.getRequestAttributes().getAttribute("userInfo", RequestAttributes.SCOPE_SESSION);
		return mainDAO.listMenu(userInfo.getRoleId());
	}	
	
	// �޴�
	public List<MainVO> listMenuAll() throws SQLException {
		UserVO userInfo = (UserVO) RequestContextHolder.getRequestAttributes().getAttribute("userInfo", RequestAttributes.SCOPE_SESSION);
		return mainDAO.listMenuAll(userInfo.getRoleId());
	}
	
	// �޴�
	public List<MainVO> listNotice() throws SQLException {
		UserVO userInfo = (UserVO) RequestContextHolder.getRequestAttributes().getAttribute("userInfo", RequestAttributes.SCOPE_SESSION);
		
		return mainDAO.listNotice(userInfo.getRoleId(), userInfo.getCustCode());
	}
}
